1. Field of the Invention
The present invention relates to a computer program product, system, and method for converting a first address mapping function for mapping addresses to storage locations to a second address mapping function.
2. Description of the Related Art
In a storage environment, logical addresses may be mapped to physical locations of a volume using a fixed formula where all the storage space and logical addresses are allocated in advance and the fixed formula maps the logical address to a physical location. This fixed formula mapping is used for a thick provisioned volume in which all data for the volume is allocated in advance, even before the logical addresses are used by an application. In a thin provisioned volume, storage space is allocated to a logical address only when the logical addresses are used. In this way, logical addresses are not allocated that point to free or unused space, unlike in a thick provisioned volume where physical space is pre-allocated.
Thin provisioned volumes provide a more space efficient allocation of storage space that is often used in virtual storage systems where storage space is only allocated when needed and space is not wasted by allocating in advance of being used or needed. Thin provisioned volumes may use a B-tree to represent logical address to physical address mapping. If a requested logical address is not represented in the B-tree, then storage space is allocated to the requested logical address and a new leaf node is added to the B-tree for the new logical address that identifies the allocated physical storage space. Some B-trees might have free space in existing nodes, to add mappings, so that a new mapping might not always require a new B-tree node.
It has been reported that in many thick provisioned volumes, on average only 40-45% of the allocated volume is used, resulting in a substantial amount of unused physical spaced allocated and not utilized.
Solutions are provided to migrate a thick provisioned volume to the more space efficient thin provisioned volume. Current solutions first scan the thick provisioned volume being migrated for zeros to determine unused space, and those regions deemed to have free space are not migrated or written to the target provisioned thin volume. The B-tree for the thin provisioned volume is then constructed from the migrated data, which excludes free space, so in the thin provisioned volume only logical addresses pointing to user data are allocated and free space is not allocated.
There is a need in the art for improved techniques for converting an address mapping function that allocates storage space to logical addresses in advance to an address mapping function that does not allocate the storage space until the logical addresses are used.